<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('店铺列表')" />
</head>
<body class="gray-bg">
     <div class="container-div">
        <div class="row">
            <div class="col-sm-12 search-collapse">
                <form id="formId">
                    <div class="select-list">
                        <ul>
                            <li>
                                <label>手机号：</label>
                                <input type="text" name="mobile"/>
                            </li>
                            <li>
                                <label>在线状态：</label>
                                <select name="onlineStatus" th:with="type=${@dict.getType('online_status')}">
                                    <option value="">所有</option>
                                    <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
                                </select>
                            </li>
                            <li>
                                <label>商家名称：</label>
                                <input type="text" name="storeName"/>
                            </li>
                            <li>
                                <label>自动出餐：</label>
                                <select name="autoOut" th:with="type=${@dict.getType('auto_out_status')}">
                                    <option value="">所有</option>
                                    <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
                                </select>
                            </li>
                            <li>
                                <label>自动回评：</label>
                                <select name="autoReplay" th:with="type=${@dict.getType('auto_replay')}">
                                    <option value="">所有</option>
                                    <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
                                </select>
                            </li>
                            <li>
                                <label>平台：</label>
                                <select name="platform" th:with="type=${@dict.getType('store_type')}">
                                    <option value="">所有</option>
                                    <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
                                </select>
                            </li>
                            <li>
                                <label>店铺状态：</label>
                                <select name="storeStatus" th:with="type=${@dict.getType('store_status')}">
                                    <option value="">所有</option>
                                    <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
                                </select>
                            </li>
                            <li class="select-time">
                                <label>到期时间：</label>
                                <input type="text" class="time-input" id="startTime" placeholder="开始时间" name="params[beginExpireTime]"/>
                                <span>-</span>
                                <input type="text" class="time-input" id="endTime" placeholder="结束时间" name="params[endExpireTime]"/>
                            </li>
                            <li>
                                <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
                                <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
                            </li>
                        </ul>
                    </div>
                </form>
            </div>

            <div class="btn-group-sm" id="toolbar" role="group">
                <a class="btn btn-primary single disabled" onclick="$.operate.edit()" shiro:hasPermission="system:store:edit">
                    <i class="fa fa-edit"></i> 修改
                </a>
            </div>
            <div class="col-sm-12 select-table table-striped">
                <table id="bootstrap-table"></table>
            </div>
        </div>
    </div>
    <th:block th:include="include :: footer" />
    <script th:inline="javascript">
        var editFlag = [[${@permission.hasPermi('system:store:edit')}]];
        var removeFlag = [[${@permission.hasPermi('system:store:remove')}]];
        var onlineStatusDatas = [[${@dict.getType('online_status')}]];
        var autoOutDatas = [[${@dict.getType('auto_out_status')}]];
        var autoReplayDatas = [[${@dict.getType('auto_replay')}]];
        var platformDatas = [[${@dict.getType('store_type')}]];
        var storeStatusDatas = [[${@dict.getType('store_status')}]];
        var prefix = ctx + "system/store";

        $(function() {
            var options = {
                url: prefix + "/list",
                createUrl: prefix + "/add",
                updateUrl: prefix + "/edit/{id}",
                removeUrl: prefix + "/remove",
                exportUrl: prefix + "/export",
                modalName: "店铺",
                columns: [{
                    checkbox: true
                },
                {
                    field: 'id',
                    title: '主键ID',
                    visible: false
                },
                {
                    field: 'mobile',
                    title: '手机号'
                },
                {
                    field: 'onlineStatus',
                    title: '在线状态',
                    formatter: function(value, row, index) {
                       return $.table.selectDictLabel(onlineStatusDatas, value);
                    }
                },
                {
                    field: 'storeName',
                    title: '商家名称'
                },
                {
                    field: 'autoOut',
                    title: '自动出餐',
                    formatter: function(value, row, index) {
                       return $.table.selectDictLabel(autoOutDatas, value);
                    }
                },
                {
                    field: 'autoReplay',
                    title: '自动回评',
                    formatter: function(value, row, index) {
                       return $.table.selectDictLabel(autoReplayDatas, value);
                    }
                },
                {
                    field: 'platform',
                    title: '平台',
                    formatter: function(value, row, index) {
                       return $.table.selectDictLabel(platformDatas, value);
                    }
                },
                {
                    field: 'createDate',
                    title: ''
                },
                {
                    field: 'storeStatus',
                    title: '店铺状态',
                    formatter: function(value, row, index) {
                       return $.table.selectDictLabel(storeStatusDatas, value);
                    }
                },
                {
                    field: 'expireTime',
                    title: '到期时间'
                },
                {
                    title: '操作',
                    align: 'center',
                    formatter: function(value, row, index) {
                        var actions = [];
                        actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.id + '\')"><i class="fa fa-edit"></i>修改参数</a> ');
                        actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="orderlist(\'' + row.id + '\')"<i class="fa fa-edit"></i>出餐记录</a> ');
                        actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="record(\'' + row.id + '\')"><i class="fa fa-edit"></i>续费记录</a> ');
                        return actions.join('');
                    }
                }]
            };
            $.table.init(options);
        });
    </script>

     <script th:inline="javascript">
	    /* 查看出餐记录 */
		function orderlist(storeId) {
		    var recordurl = ctx + "system/order";
		    var url = recordurl + '/'+storeId;
		    $.modal.open("出餐记录", url,'800', '720');
		}

		/* 续费记录 */
		function record(storeId) {
		    var recordurl = ctx + "system/record";
		    var url = recordurl + '/'+storeId;
		    $.modal.open("续费记录", url,'800', '720');
		}
    </script>
</body>
</html>